<template>
  <div class="main">
    <keep-alive>
      <router-view
        @hide="hide"
        @show="show"
        v-if="$route.meta.keep"
      ></router-view>
    </keep-alive>

    <router-view
      @hide="hide"
      @show="show"
      v-if="!$route.meta.keep"
    ></router-view>

    <footer-bar v-show="isShow"></footer-bar>
  </div>
</template>

<script>
import footerBar from "./components/footerBar.vue";
import { getShopList } from "./api/shopList.js";
import { getUserInfo } from "./api/user.js";
import { getClassList } from "./api/classList.js";
export default {
  data() {
    return {
      isShow: true,
    };
  },
  methods: {
    hide() {
      this.isShow = false;
    },
    show() {
      this.isShow = true;
    },
  },
  components: {
    footerBar,
  },
  created() {
    getShopList().then((data) => {
      sessionStorage.setItem("shopList", JSON.stringify(data.listAll));
    });
    getUserInfo().then((data) => {
      sessionStorage.setItem("userInfo", JSON.stringify(data));
    });
    getClassList().then((data) => {
      sessionStorage.setItem("classList", JSON.stringify(data));
    });
  },
};
</script>

<style lang="scss" scoped>
@import url(./assets/css/base.css);
@import url(./assets/css/header_1.css);
@import url(./assets/css/header_2.css);
</style>